﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YunBox2.Contracts.Core;
using FluentNHibernate.Mapping;



namespace YunBox2.DAL.Maps
{
    public class BillBaseMap:ClassMap<BillBase>
    {
        public BillBaseMap()
        {
            Id(x => x.Id).GeneratedBy.Guid().Default("(newid())");
            Map(x => x.SerialNo).Length(32).Not.Nullable();
            Map(x => x.HappenDate);
            Map(x => x.IsDraft).Not.Nullable().Default("1").CustomSqlType("bit");
            Map(x => x.CreatedTime);
            References(x => x.CreatedUser).Column("CreateUserID").Not.Nullable();
            Map(x => x.LastModifiedTime).Not.Nullable();
            References(x => x.LastModifiedUser).Column("LastModifiedUserID").Not.Nullable();

            Map(x => x.IsSubmited).Default("0").CustomSqlType("bit");
            Map(x => x.SubmitedTime);
            References(x => x.SubmitedUser).Column("SubmitedUserID").Not.Nullable();

            Map(x => x.IsAudited).Default("0").CustomSqlType("bit");
            Map(x => x.AuditedTime);
            References(x => x.AuditedUser).Column("AuditedUserID").Not.Nullable();

            Map(x => x.IsApproved).Default("0").CustomSqlType("bit");
            Map(x => x.ApprovedTime);
            References(x => x.ApprovedUser).Column("ApprovedUserID").Not.Nullable();

            Map(x => x.IsInvalid).Default("0").CustomSqlType("bit");
            Map(x => x.InvalidTime).Not.Nullable();
            References(x => x.InvalidUser).Column("InvalidUserID").Not.Nullable();
            Table("BillBase");
        
        }
    }
}
